<% content_for(:head) do -%>

  <%= javascript_include_tag :ckeditor -%>

  <script type="text/javascript">
    $(function(){
      $('#summary-button').toggle(function(){
        $('#summary-wrap').show();
        $('#use-summary').val('true')
        $(this).val('隐藏摘要');
        location.href = "#summary-wrap";
      },function(){
        $('#summary-wrap').hide();
        $('#use-summary').val('false')
        $(this).val('编写摘要');
      });
    });
  </script>

<% end %>


<div id="main">
  <div class="cl">&nbsp;</div>

  <%= form_for [:admin,@article] do |f| %>

    <!-- Content -->
    <div id="content">

      <!-- Box -->
      <div class="box">
        <!-- Box Head -->
        <div class="box-head">
          <h2><%= @title %></h2>
        </div>
        <!-- End Box Head -->

        <!-- Form -->
        <div class="form">
          <p>
            <span class="req">max 100 symbols</span>
            <label>文章标题 <span>(必填)</span></label>
            <%= f.text_field :title, :class => "field size1" %>
          </p>

          <p>
            <span class="req">max 10000 symbols</span>
            <label>文章内容 <span>(必填)</span></label>
  <%#= f.text_area :content, :class => "field size1", :rows=>"10", :cols=>"30" %>
            <%= f.cktext_area :content, :toolbar=>'Full',  :class => "field size1" %>
          </p>

          <p id="summary-wrap" class="hide">
            <span class="req">max 1000 symbols</span>
            <label>文章摘要</label>
            <%= f.cktext_area :summary, :toolbar=>'Easy', :class => "field size1" %>
            <%= f.hidden_field :use_summary, :value => "false", :id => "use-summary" %>
          </p>
        </div>
        <!-- End Form -->

        <!-- Form Buttons -->
        <div class="buttons">
          <input type="button" class="button alignleft" id="summary-button" value="编写摘要" />
          <input type="button" class="button" value="预览" />
          <%= submit_tag '提交保存', :disable_with => "正在提交...", :class=>"button" %>
        </div>
        <!-- End Form Buttons -->

      </div>
      <!-- End Box -->

    </div>
    <!-- End Content -->

    <!-- Sidebar -->
    <div id="sidebar">

      <!-- Box -->
      <div class="box">

        <!-- Box Head -->
        <div class="box-head">
          <h2>选项</h2>
        </div>
        <!-- End Box Head-->

        <div class="box-content">
          <!-- Sort -->
          <div class="sort">
            <ul class="">
              <li class="first">
                <label>分类</label>
                <%= f.select :category_id, Category.get_options(Article),{}, :class => "field" %>
              </li>
              <li>
                <label>标签</label>
                <%= f.text_field :tag_list, :size => 20, :autocomplete => "off", :class => "field" %>
              </li>
              <li>
                <label>公开度</label>
                <%= f.select :status, Article.get_status_types,{}, :class => "field" %>
              </li>
              <li class="last">
                <label>密码</label>
                <%= f.text_field :password, :size => 20, :class => "field" %>
              </li>
            </ul>
          </div>
          <!-- End Sort -->

        </div>
      </div>
      <!-- End Box -->
    </div>
    <!-- End Sidebar -->

  <% end %>

  <div class="cl">&nbsp;</div>
</div>